﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Inspire.Entities
{
    public partial class CustomBooleanField : CustomField
    {
        /// <summary>
        /// Returns the Boolean value of this field as an object.
        /// </summary>
        /// <returns>(object) The value of this field.</returns>
        public override object GetData()
        {
            return this.Data;
        }

        /// <summary>
        /// Implementation of the abstract SetData method for the CustomBooleanField class.
        /// </summary>
        /// <param name="data">(Object) A Boolean object.</param>
        public override void SetData(Object data)
        {
            if (data is Boolean)
            {
                this.Data = (Boolean)data;
            }
        }

        /// <summary>
        /// Returns "True," "False," or "Null" depending on the actual value of this field.
        /// </summary>
        /// <returns>(String) True, False, or Null.</returns>
        public override string ToString()
        {
            if (this.Data != null)
            {
                if (this.Data == true)
                {
                    return "True";
                }
                else
                {
                    return "False";
                }
            }
            
            return "Null";
        }
    }
}
